//
//  ParticularsViewController.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/10/19.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "ParticularsViewController.h"
#import "DebatestormdetailsTableViewCell.h"
#import "BettingView.h"
#import "BettingOppose.h"
@interface ParticularsViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    BettingView * bettingView;//押注
    BettingOppose * bettingOppose;
}

@property(nonatomic, strong) UITableView * tableView;

@property(nonatomic, strong) UIButton * backBut;//关闭


@end

@implementation ParticularsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.backgroundColor=[UIColor whiteColor];
    
    self.navigationItem.title=@"辩论风暴";
    //导航条左边按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fanhui1"] style:UIBarButtonItemStyleDone target:self action:@selector(clickLeftBarButton)];
    //导航条右边按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"xialagenduo"] style:UIBarButtonItemStyleDone target:self action:@selector(clickRightButton)];
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:17]};
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg"]forBarMetrics:UIBarMetricsDefault];
    
    //表格设置
    [self.view addSubview:self.tableView];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;// 去掉所有cell的分割线
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;  // 侧滑返回
    //押注界面响应时间
    [self setYazhuUp];

}
//导航条返回按钮响应
- (void)clickLeftBarButton
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)clickRightButton
{
    
}

//押注界面响应时间
- (void)setYazhuUp
{
    
    
}


//押注 按钮响应窗口
- (void)yazhuxiangying:(UIButton *)sender
{
    UIButton *yazhuxiangying = (UIButton *)sender;
    if (yazhuxiangying.tag == 1000010)
    {
        bettingView=[[BettingView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, UIScreenHeight)];
        bettingView.backgroundColor= [UIColor colorWithWhite:0 alpha:0.8];
        [self.view addSubview:bettingView];
        
        _backBut=[[UIButton alloc] init];
        [_backBut setImage:[UIImage imageNamed:@"guanbi"] forState:UIControlStateNormal];
        [_backBut addTarget:self action:@selector(backButView) forControlEvents:UIControlEventTouchUpInside];
        [bettingView addSubview:_backBut];
        self.navigationController.navigationBar.hidden = YES;
        _backBut.sd_layout
        .topSpaceToView(bettingView, kHeightScale(62/2))
        .rightSpaceToView(bettingView, kWidthScale(30/2))
        .widthIs(kWidthScale(36/2))
        .heightIs(kHeightScale(36/2));
        //确定按钮
        [bettingView.determine addTarget:self action:@selector(backButView) forControlEvents:UIControlEventTouchUpInside];
        NSLog(@"123123123");
    }else if (yazhuxiangying.tag ==1000011)
    {
        bettingOppose=[[BettingOppose alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, UIScreenHeight)];
        bettingOppose.backgroundColor= [UIColor colorWithWhite:0 alpha:0.8];
        [self.view addSubview:bettingOppose];
        
        _backBut=[[UIButton alloc] init];
        [_backBut setImage:[UIImage imageNamed:@"guanbi"] forState:UIControlStateNormal];
        [_backBut addTarget:self action:@selector(backButView) forControlEvents:UIControlEventTouchUpInside];
        [bettingOppose addSubview:_backBut];
        self.navigationController.navigationBar.hidden = YES;
        _backBut.sd_layout
        .topSpaceToView(bettingOppose, kHeightScale(62/2))
        .rightSpaceToView(bettingOppose, kWidthScale(30/2))
        .widthIs(kWidthScale(36/2))
        .heightIs(kHeightScale(36/2));
        
        //确定按钮
        [bettingOppose.determineF addTarget:self action:@selector(backButView) forControlEvents:UIControlEventTouchUpInside];

        NSLog(@"321321321");
    }
}
//退回当前View
- (void)backButView
{
    bettingView.hidden = YES;
    bettingView.alpha=0.1;
    
    bettingOppose.hidden = YES;
    bettingOppose.alpha=0.1;
    self.navigationController.navigationBar.hidden = NO;
}

#pragma mark ---表格
- (UITableView *)tableView
{
    if (!_tableView)
    {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kHeightScale(0), UIScreenWidth, kHeightScale(280)) style:UITableViewStylePlain];
        
        _tableView.delegate = self;
        
        _tableView.dataSource = self;
        _tableView.userInteractionEnabled=YES;
    }
    return _tableView;
}
//返回每个分区下的单元格个数，必须实现
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return kHeightScale(280);
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString * str= @"biao";
    DebatestormdetailsTableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:str];
    if (!cell) {
        
        cell=[[DebatestormdetailsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str];
    }
    //押注 按钮响应窗口
    [cell.zhengBut addTarget:self action:@selector(yazhuxiangying:) forControlEvents:UIControlEventTouchUpInside];
    [cell.fanBut addTarget:self action:@selector(yazhuxiangying:) forControlEvents:UIControlEventTouchUpInside];
    cell.selectionStyle=UITableViewStylePlain;
    //cell.backgroundColor=[UIColor orangeColor];
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
